<template>
  <t-dialog
    :header="header"
    :visible.sync="visible"
    :onClose="closeDialog"
    :closeOnOverlayClick="false"
    :confirmBtn="null"
    width="80%"
    top="5%"
  >
  <div style="height: 65vh">
    <t-table
      rowKey="id"
      :data="formData.reviewItems"
      :columns="columns2"
      bordered
      hover
    >
      <template #id="{rowIndex}">
        {{ rowIndex + 1 }}
      </template>
    </t-table>
  </div>
  </t-dialog>
</template>

<script>
export default {
  name: "review-standard-list",
  props: {
    header: String,
    objId: [String,Number],
  },
  data(){
    return {
      visible: true,
      formData:{
        reviewItems:[]
      },
      columns2:[
        {
          colKey: "id",
          title: "序号",
          align: "center",
          width: 100
        },
        {
          colKey: "name",
          title: "指标名称",
          align: "center",
        },
        {
          colKey: "note",
          title: "指标说明",
          align: "center",
        },
        {
          colKey: "score",
          title: "分值",
          align: "center",
        },
      ],
    }
  },
  watch: {
    objId: {
      immediate: true,
      handler(val) {
        if (val) {
          this.getObj();
        }
      }
    }
  },
  methods:{
    getObj() {
      this.$api.kjxm.review.indexGet(this.objId).then((response) => {
        this.formData = response.data;
      });
    },
    closeDialog() {
      this.$emit("update:visible", false);
    },
  }
}
</script>

<style scoped>

</style>
